﻿<Window xmlns:my="clr-namespace:CrossRoadNS.Views"  x:Class="CrossRoadNS.Views.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:uc="clr-namespace:CrossRoadNS.Views.UserControls"
        Title="cross road" Height="400" Width="600">
    
    <Window.Resources>
        <Style x:Key="MenuButtonStyle" TargetType="Button">
            <Setter Property="Width" Value="100"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Margin" Value="5,0,5,0"/>
        </Style>
    </Window.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        
        <StackPanel DataContext="{Binding crossRoad}" Margin="10">
            <TextBlock Text="{Binding Path=CarCollection.Count, StringFormat='Cars: {0}'}"
                       Visibility="Collapsed"/>
            <TextBlock Text="{Binding Path=CurrentPhase.index, StringFormat='Phase: {0}'}"/>
        </StackPanel>
        
        <Grid Grid.Row="1" Margin="10" Background="LightGreen" Name="GrassGrid">
            <uc:CrossRoadUc x:Name="cruc" DataContext="{Binding crossRoad}" />
        </Grid>
        
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10" Grid.Row="2">
            <Button Content="Init" Name="InitButton"
                    Style="{StaticResource ResourceKey=MenuButtonStyle}" Click="InitButton_Click" />
            <Button Content="Start" Name="TimerButton" IsEnabled="False"
                    Style="{StaticResource ResourceKey=MenuButtonStyle}" Click="TimerButton_Click" />
        </StackPanel>
        
    </Grid>
</Window>
